﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using ResourceCollectionDomain;
using ResourceCollectionDomain.Entity;

namespace ResourceCollectionDao
{
    public class VisitedDao
    {
        public static void DeleteCanReCatchedUrlsFromVisited()
        {
            using (var db = new DBDataContext())
            {
                List<Visited> list = new List<Visited>();
                foreach (KeyValuePair<string, string> url in DataDic.CanReCatchedUrlsDic)
                {
                    Visited visited = db.Visited.FirstOrDefault(x => x.Url == url.Key);
                    if (visited != null)
                        list.Add(visited);
                }
                db.Visited.DeleteAllOnSubmit(list);
                db.SubmitChanges();
            }
            ;
        }
    }
}
